<style>
.layui-input-block{
margin-left:120px;
}
</style>
<!-- start form -->
<form class="layui-form" action="" id="orderEditForm">
	<div class="layui-row" style="margin-top:10px;">
		<input class="layui-input" type="hidden" th:value="${companyId}" id="companyId" name="companyId">
		<input class="layui-input" type="hidden" th:value="${supplierCustomerId} "id="supplierCustomerId" name="supplierCustomerId">
	      <div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
	          <label class="layui-form-label" style="width:120px;">结算币种：</label>
	          <div class="layui-input-block" style="width:200px;">
	              <select  name="currency" id="currency" lay-verify="required">
	              	  <option th:value="-1" selected>请选择币种</option>
	                  <option th:each="ec:${currencyType}" th:value="${ec.id}" th:text="${ec.name}"></option>
	              </select>
	          </div>
	      </div>
	      <div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
	          <label class="layui-form-label" style="width:120px;">结算方式：</label>
	          <div class="layui-input-block" style="width:200px;">
				 <select  id="statementType" name="type" lay-verify="required">
	                  <option th:value="-1" selected>请选择结算方式</option>
	                  <option th:each="ec:${statementType}" th:value="${ec.code}" th:text="${ec.value}"></option>
	              </select>
	          </div>
	      </div>
	      </div>
	<div class="layui-row" style="margin-top:10px;">
	      <div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
	          <label class="layui-form-label" style="width:120px;">周结天数：</label>
	          <div class="layui-input-block" style="width:200px;">
	              <input type="text" class="layui-input" name="dates"  lay-verify="required|number" >
	          </div>
	      </div>
	      <div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
	          <label class="layui-form-label" style="width:120px;">对账开始时间：</label>
	          <div class="layui-input-block" style="width:200px;">
	              <input type="text" class="layui-input" name="star" placeholder="yyyy-mm-dd" lay-verify="required|date" >
	          </div>
	      </div>
	      </div>
	<div class="layui-row" style="margin-top:10px;">
	      <div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
	          <label class="layui-form-label" style="width:120px;">对账结束时间：</label>
	          <div class="layui-input-block" style="width:200px;">
	             <input type="text" class="layui-input" name="end" placeholder="yyyy-mm-dd" lay-verify="required|date" >
	          </div>
	      </div>
	      
	      <div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
	          <label class="layui-form-label" style="width:120px;">是否默认结算方式：</label>
	          <div class="layui-input-block" style="width:200px;">
	             <select  id="isDefault" name="isDefault" lay-verify="required">
	                  <option value="0" selected>否</option>
	                  <option value="1">是</option>
	              </select>
	          </div>
	      </div>
	      </div>
	<div class="layui-row" style="margin-top:10px;">
	      <div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
	          <label class="layui-form-label" style="width:120px;">说明：</label>
	          <div class="layui-input-block" style="width:200px;">
	              <textarea class="layui-textarea"   style="min-height: 50px;" name="remark"></textarea>
	          </div>
	      </div>
   </div>
   <div class="layui-row" style="margin-top:30px;" >
	    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12" style="text-align:center;">
	          <button class="layui-btn" lay-submit="" lay-filter="formSubmit">提交</button>
	      	<button type="button" class="layui-btn layui-btn-primary" id="closeBtn">关闭</button>
	    </div>
  </div>
</form>
<!-- end form -->
<script>
layui.use('form',function() {
	var form = layui.form;
	form.render();
	//表单提交监听
	form.on('submit(formSubmit)',function(data) {
		var currency = $("#currency").val();
		var type = $("#statementType").val();
		console.log("type="+type);
		if(currency == -1) {
			layer.msg("请选择币种信息");
			return false;
		}
		if(type == -1) {
			layer.msg("请选择结算方式");
			return false;
		}
		 $.ajax({url:'/com/customer/supplier/statement/add',
				data:$("#orderEditForm").serializeJson(),
				type:"get",
				contentType:"application/json",
				success:function(data){
					if(data.code==200){
						layer.msg("数据保存成功！");
						layer.closeAll();
					}else{
						layer.msg(data.message);
					}
				}});
			return false;
	});
	$("#closeBtn").click(function() {
		layer.closeAll();
	});
});
</script>